<template>
    <div class="hello">
        <div class="text">{{JSON.stringify(msg)}}</div>
        <div class="btn" @click="clickAction">点击</div>
    </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: ""
    }
  },
  methods: {
    clickAction: function () {
       window.bridge.add('getUserInfo', {
        name: '123'
      }, ({data, success, message}) => {
        if (success) {
          console.log(data);
          this.msg = data
        } else {
          console.log(message);
          this.msg = message
        }
      });

      // this.$bridge.publish({callbackId, data: '调用成功返回信息', success: true});
      // this.$bridge.publish({callbackId, message: '调用失败原因', success: false});
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.btn {
    width: 100px;
    height: 40px;
    background-color: red;
    display: flex;
    justify-content: center;
    align-items: center;
}

.text {
    font-size: 15px;
}
</style>
